﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using System.Web.Mvc;

namespace SafeTraveller
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            config.Routes.MapHttpRoute(
               name: "ValueController",
               routeTemplate: "api/{controller}/{datefrom}/{dateto}/{type}",
               defaults: new { type = RouteParameter.Optional, datefrom = RouteParameter.Optional, dateto = RouteParameter.Optional }
           );

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );

            //config.Routes.MapHttpRoute(
            //    name: "DefaultNew",
            //    routeTemplate: "{controller}/{action}/{datefrom}/{dateto}/{type}",
            //    defaults: new { controller = "OAuthController", action = "Index", datefrom = RouteParameter.Optional, dateto = RouteParameter.Optional, type = RouteParameter.Optional }
            //);

            config.Routes.MapHttpRoute(
               name: "OAuthController",
               routeTemplate: "api/oauth/{datefrom}/{dateto}/{type}",
               defaults: new
               {
                   controller = "OAuth"
               }
           );
        }
    }
}
